package com.excesys.exsecs.energy.controller;


import com.excesys.exsecs.common.core.util.R;
import com.excesys.exsecs.energy.service.*;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import org.springframework.http.HttpHeaders;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;


/**
 * @author zhangtailong
 * @title: EcAnalyzeController
 * @projectName pigx
 * @description: 中台 -- 能耗对比
 * @date 2024/03/01 10:25
 */
@RestController
@RequiredArgsConstructor
@RequestMapping("/eccontrast")
@Tag(name = "能耗对比")
@SecurityRequirement(name = HttpHeaders.AUTHORIZATION)
public class EcContrastController {

    //部门维度表
    private final DimDeptService dimDeptService;
    //区域维度表
    private final DimAreaService dimAreaService;
    //重点设备表
    private final DimKeqService dimKeqService;
    //分项维度表
    private final DimSubitemService dimSubitemService;
    //支路维度表
    private final DimBranchService dimBranchService;


    /*
     * 部门 - 能耗对比
     * @param ids 查询id ids
     * @param date 查询时间 yyyy、yyyy-MM、yyyy-MM-dd
     * */
    @Operation(summary = "部门能耗对比", description = "部门能耗对比")
    @GetMapping("/powerDeptContrast")
    public R powerDeptContrast(String energyType, String ids, String startDate, String endDate) {
        return R.ok(dimDeptService.powerDeptContrast(ids, startDate, endDate), "部门能耗对比");
    }


    /*
     * 区域 - 能耗对比
     * @param ids 查询id ids
     * @param startDate 查询时间 yyyy、yyyy-MM、yyyy-MM-dd
     * @param endDate 查询时间 yyyy、yyyy-MM、yyyy-MM-dd
     *@param type  //1时 2日 3月 4年
     *@param energyType 1电 2水 3冷
     * */
    @Operation(summary = "区域能耗对比", description = "区域能耗对比")
    @GetMapping("/powerAreaContrast")
    public R powerAreaContrast(String energyType, String ids, String startDate, String endDate) {
        return R.ok(dimAreaService.powerAreaContrast(ids, startDate, endDate), "区域能耗对比");
    }

    /*
     * 重点设备 - 能耗对比
     * @param ids 查询id ids
     * @param date 查询时间 yyyy、yyyy-MM、yyyy-MM-dd
     * */
    @Operation(summary = "重点设备能耗对比", description = "重点设备能耗对比")
    @GetMapping("/powerKeqContrast")
    public R powerKeqContrast(String energyType, String ids, String startDate, String endDate) {
        return R.ok(dimKeqService.powerKeqContrast(ids, startDate, endDate), "重点设备能耗对比");
    }

    /*
     * 分项 - 能耗对比
     * @param ids 查询id ids
     * @param date 查询时间 yyyy、yyyy-MM、yyyy-MM-dd
     * */
    @Operation(summary = "分项能耗对比", description = "分项能耗对比")
    @GetMapping("/powerSubitemContrast")
    public R powerSubitemContrast(String ids, String startDate, String endDate) {
        return R.ok(dimSubitemService.powerSubitemContrast(ids, startDate, endDate), "分项能耗对比");
    }


    /*
     * 支路 - 能耗对比
     * @param ids 查询id ids
     * @param date 查询时间 yyyy、yyyy-MM、yyyy-MM-dd
     * */
    @Operation(summary = "支路能耗对比", description = "支路能耗对比")
    @GetMapping("/powerBranchContrast")
    public R powerBranchContrast(String ids, String startDate, String endDate) {
        return R.ok(dimBranchService.powerBranchContrast(ids, startDate, endDate), "支路能耗对比");
    }


}
